/**
 * Apr 2, 2014 2:42:43 PM
 */
package elitech.vietnam.weatherfashion.tabs.settings;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import elitech.vietnam.weatherfashion.MainActivity;
import elitech.vietnam.weatherfashion.R;
import elitech.vietnam.weatherfashion.WFApplication;
import elitech.vietnam.weatherfashion.config.GlobalValue;
import elitech.vietnam.weatherfashion.dto.MemberDTO;
import elitech.vietnam.weatherfashion.tabs.AbstractFragment;
import elitech.vietnam.weatherfashion.widget.NotifyButton;

/**
 * @author Cong
 *
 */
public class GuidePersonalFragment extends AbstractFragment implements View.OnClickListener {

	NotifyButton button_notification;
	Button mButtonBack;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.settings_guidepersonal, container, false);
		setupView(view);

		mButtonBack = (Button) view.findViewById(R.id.stguidepersonal_button_back);
		button_notification = (NotifyButton) view.findViewById(R.id.button_notification);
		((MainActivity) getActivity()).setCurrentNotifyButton(button_notification);

		MemberDTO m = GlobalValue.getInstance(getActivity()).readUserInfo();
		if (m == null)
			button_notification.setVisibility(View.GONE);
		else 
			button_notification.setVisibility(View.VISIBLE);
		//button_notification.setOnClickListener(this);
		mButtonBack.setOnClickListener(this);

		return view;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.stguidepersonal_button_back:
			getActivity().onBackPressed();
			break;
		case R.id.button_notification:
			Log.w("Notification", "Num Count: " + WFApplication.getInstance().mListNoti.size());
			((MainActivity) getActivity()).mNotiWindow.showAsDropDown(button_notification);
			((MainActivity) getActivity()).mNotiWindow.notifyDataChanged();
			button_notification.setNumber(0);
			break;
		default:
			break;
		}
	}
}
